package eclipse.client.forms;
import javax.swing.*;
import eclipse.lib.*;
import eclipse.util.*;
import eclipse.util.io.*;
public class Login extends StandardForm
{
	public Login(String sTitle, int iXLoc, int iYLoc, ERL eImg) 
	{		
		super(sTitle, iXLoc, iYLoc, eImg);
		initComponents();	
		validate();
	}
	public static final long serialVersionUID = 1L;
	public JTextField txtUName;
	public JPasswordField txtPWord;
	private void initComponents() 
	{
		int unameX, unameY, unameW, unameH;
		int pwordX, pwordY, pwordW, pwordH;
		int formW, formH;
		
		formW = this.getWidth();
		formH = this.getHeight();
		
		PropertyFile pFile = new PropertyFile(new ERL("jar://config").openStream());
		
		unameX = Integer.parseInt(pFile.readProperty("LOGIN", "INPUT", "UNAME", "X"));
		unameY = Integer.parseInt(pFile.readProperty("LOGIN", "INPUT", "UNAME", "Y"));
		unameW = Integer.parseInt(pFile.readProperty("LOGIN", "INPUT", "UNAME", "W"));
		unameH = Integer.parseInt(pFile.readProperty("LOGIN", "INPUT", "UNAME", "H"));
		
		pwordX = Integer.parseInt(pFile.readProperty("LOGIN", "INPUT", "PWORD", "X"));
		pwordY = Integer.parseInt(pFile.readProperty("LOGIN", "INPUT", "PWORD", "Y"));
		pwordW = Integer.parseInt(pFile.readProperty("LOGIN", "INPUT", "PWORD", "W"));
		pwordH = Integer.parseInt(pFile.readProperty("LOGIN", "INPUT", "PWORD", "H"));
		
        txtUName = new JTextField();
        txtPWord = new JPasswordField();
        
        GroupLayout layout = new GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(unameX, unameX, unameX)                
                .addComponent(txtUName, unameW, unameW, unameW)                
                .addContainerGap(formW - (unameX + unameW + 17), Short.MAX_VALUE))
            .addGroup(layout.createSequentialGroup()
            	.addGap(pwordX, pwordX, pwordX)            	
            	.addComponent(txtPWord, pwordW, pwordW, pwordW)
            	.addContainerGap(formW - (pwordX + pwordW + 17), Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(unameY, unameY, unameY)
                .addComponent(txtUName, unameH, unameH, unameH)
                .addContainerGap(formH - (unameY + unameH + 10), Short.MAX_VALUE))
            .addGroup(layout.createSequentialGroup()
                .addGap(pwordY, pwordY, pwordY)
                .addComponent(txtPWord, pwordH, pwordH, pwordH)
                .addContainerGap(formH - (pwordY + pwordH + 10), Short.MAX_VALUE))
        );

        pack();
    }
}
